/**
 * 
 */
package com.redside.webapp.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.redside.model.Complaint;
import com.redside.service.GenericManager;

/**
 * @author <a href="mailto:pchapman@easystreet.net">Peter Chapman</a>
 *
 */

public class ComplaintController implements Controller {
	
    private final Log logger = LogFactory.getLog(ComplaintController.class);
    private GenericManager<Complaint, Long> complaintManager = null;

    public void setComplaintManager(GenericManager<Complaint, Long> complaintManager) {
        this.complaintManager = complaintManager;
    }

    public ModelAndView handleRequest(HttpServletRequest request,
                                      HttpServletResponse response)
    throws Exception {
        logger.debug("entering 'handleRequest' method...");

        return new ModelAndView().addObject(complaintManager.getAll());
    }
}